#pragma once

namespace col 
{

typedef std::deque < wxUint32 > TrackStartFrameDeque;

/*! @brief CDDB disc ID generator.
 *
 * @note The discid compilation & usage is only tested under Windows XP due to 
 * the lack of possibilities to use other platforms.
 * 
 * @todo The GetMountedDrives is called from a worker thread (not multiple threads
 *       though) so should it be modified to be "thread-safe"?
 **/
class CddbDiscId
{
public:
	//! Default constructor.
	CddbDiscId();
	//! Constructor with the input device.
	CddbDiscId ( const wxString &rDevice );

	//! Sets the input device from which the ID will be calculated.
	void SetDevice ( const wxString &rDevice );

	wxUint32 GetId() const;
	wxUint32 GetTrackCount() const;
	//! Returns the length of the prev. calculated disc in seconds.
	unsigned long GetDiscLengthInSeconds() const;

	const wxString &GetTrackLength ( wxUint32 track ) const;

	bool CalculateId();

	static const string_deque &GetMountedDrives ( bool forceReQuery );
	const TrackStartFrameDeque &GetTrackStartFrames() const;
private:
	//! This function is directly from the FreeDb how-to.
	static wxInt32 CalcSum ( wxInt32 n );

	wxString mDevice;

	wxUint32 mTrackCount;
	wxUint32 mCddbDiscId;
	wxUint32 mDiscLengthInSecs;

	TrackStartFrameDeque mTrackStartFrames;
	static string_deque msMountedVolumes;
	std::map < wxUint32, wxString > mTrackLengthMap;
};

}